//
//  SEDoctorDetailReserveServiceSectionHeader.swift
//  SmartEyeForPatient
//
//  Created by QDSG on 2021/4/13.
//

import UIKit

class SEDoctorDetailReserveServiceSectionHeader: UIView {
    
    var tappedClosure: (() -> Void)?
    
    private var isExpanded: Bool = false
    
    func updateWithViewModel(_ viewModel: SERegistrationDoctorModel) {
        nameLabel.text = viewModel.hospitalName
        if viewModel.isOpen {
            arrowImageView.transform = .identity
        } else {
            arrowImageView.transform = CGAffineTransform(rotationAngle: .pi)
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        backgroundColor = .white

        setLayerCorners(rect: bounds, radius: 6, corners: [.topLeft, .topRight])
        
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapped))
        addGestureRecognizer(tapGesture)
    }
    
    @objc private func didTapped() {
        tappedClosure?()
    }

    @IBOutlet private weak var nameLabel: UILabel!
    @IBOutlet private weak var withNumLabel: UILabel!
    @IBOutlet private weak var arrowImageView: UIImageView!

}
